#include "filemanager.h"
#include "ui_filemanager.h"

FileManager::FileManager(QWidget *parent)
    : QWidget(parent), ui(new Ui::FileManager)
{
    ui->setupUi(this);
    connect(ui->actFlush, SIGNAL(triggered()), this, SIGNAL(flush()));
    connect(ui->actMain, SIGNAL(triggered()), this, SIGNAL(mainlist()));
    connect(ui->actParent, SIGNAL(triggered()), this, SIGNAL(parentdir()));
    connect(ui->actUpload, SIGNAL(triggered()), this, SIGNAL(upload()));
}

void FileManager::setDirs(const QStringList &list) {
    ui->listWidget->clear();
    for(const QString &str : list) {
        QListWidgetItem *item = new QListWidgetItem(str);
        item->setIcon(QApplication::style()->standardIcon(QStyle::StandardPixmap::SP_DirIcon));
        ui->listWidget->addItem(item);
    }
}
QListWidget* FileManager::listWidget() {
    return ui->listWidget;
}
QLineEdit* FileManager::editPath() {
    return ui->editPath;
}
